package com.bigdata.movieticketapi.controller;

import com.bigdata.movieticketapi.common.pojo.PageResult;
import com.bigdata.movieticketapi.entity.CinemaType;
import com.bigdata.movieticketapi.entity.MovieType;
import com.bigdata.movieticketapi.service.ICinemaTypeService;
import com.bigdata.movieticketapi.vo.req.*;
import com.bigdata.movieticketapi.vo.resp.PageCinemaTypeRespVO;
import com.bigdata.movieticketapi.vo.resp.PageMovieTypeRespVO;
import com.bigdata.movieticketapi.vo.resp.SelectListRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author movie
 * @since 2023-11-08
 */
@RestController
@RequestMapping("/api")
@Api(tags = "影厅类型模块")
public class CinemaTypeController {

    @Resource
    private ICinemaTypeService iCinemaTypeService;

    @PostMapping("/admin/cinemaType/add")
    @ApiOperation(value = "添加影厅类型")
    public void addMovieType(@RequestBody @Valid CinemaTypeReqVO vo){
        iCinemaTypeService.addCinemaType(vo);
    }

    @PostMapping("/admin/cinemaType/edit")
    @ApiOperation(value = "编辑影厅类型")
    public void updateMovieType(@RequestBody @Valid CinemaType cinemaType){
        iCinemaTypeService.updateCinemaType(cinemaType);
    }

    @PostMapping("/admin/cinemaType")
    @ApiOperation(value = "获取影厅分页列表")
    public PageResult<PageCinemaTypeRespVO> pageMovieTypes(@RequestBody @Valid PageCinemaTypeReqVO vo){
        return iCinemaTypeService.pageCinemaTypes(vo);
    }

    @PostMapping("/admin/cinemaType/selectList")
    @ApiOperation(value = "影厅选择器列表")
    public List<SelectListRespVO> getCinemaSelectList(){
        return iCinemaTypeService.getCinemaSelectList();
    }

}
